<!--
 * @Author: liuyonghu
 * @Date: 2021-05-14 16:46:55
 * @LastEditTime: 2021-05-25 15:59:04
 * @LastEditors: liuyonghu
 * @Description: 
 * @FilePath: \vue2amaptest\src\components\HelloWorld.vue
-->
<template>
  <div class="hello">
    <div id="mapc" style="height: 400px; width: 400px">
      <el-amap vid="amapDemo" :zoom="zoom" :center="center"> </el-amap>
    </div>
  </div>
</template>

<script>
import Vue2AMap from "vue2-amap";
export default {
  name: "HelloWorld",
  data() {
    return {
      center: [117.740433, 39.125215],
      zoom: 18,
    };
  },
  beforeCreate() {
    Vue2AMap.initAMapApiLoader({
      // 高德的key
      key: "e7152df832f53aad42466f79b0630139",
      // 插件集合
      plugin: [
        "AMap.Autocomplete",
        "AMap.PlaceSearch",
        "AMap.Scale",
        "AMap.OverView",
        "AMap.ToolBar",
        "AMap.MapType",
        "AMap.PolyEditor",
        "AMap.CircleEditor",
      ],
      // 高德 sdk 版本，默认为 1.4.4
      v: "1.4.4",
    });
  },
  created() {
    console.log("--- created --- ");
  },
  mounted() {
    setTimeout(() => {
      console.log(window.AMap);
    }, 2000);
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.hello {
  background-color: red;
  align-content: center;
  text-align: center;
}
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
